package com.leehom.arch.storage.model;

import java.util.Map;

import com.google.common.collect.Maps;

/**
 * 
 * @类名: StorageRepository
 * @说明: 存储库
 *
 * @author   
 * @Date	 2018年3月13日 下午2:19:21
 * 修改记录：
 *
 * @see
 */
public class StorageRepository {
	
	/** key: root url*/
	private Map<String, Storage> storages = Maps.newHashMap();
	
	public Storage getStorage(String rootUrl) {
		return storages.get(rootUrl);
	}

	public void setStorages(Map<String, Storage> storages) {
		this.storages.putAll(storages);
	}
	
	public void setStorage(Storage storage) {
		this.storages.put(storage.getRootUrl(), storage);
	}
	
	public void removeStorage(String rootUrl) {
		this.storages.remove(rootUrl);
	}
	
	public Map<String, Storage> getAllStorages() {
		return storages;
	}
	
}
